<%@page import="cn.ticket.Constant"%>
<%@page import="java.sql.ResultSet"%>
<%@page import="java.sql.Connection"%>
<%@page import="java.sql.PreparedStatement"%>
<%@page import="cn.ticket.db.DBConnect"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>添加车次</title>
</head>
<body>
	<jsp:include page="/front/common/head.jsp"></jsp:include>
	<%
		String userId = (String) session.getAttribute("login_user_id");
		String busId = (String) request.getParameter("id");
		Connection con = new DBConnect().getConnection();
		String sql = "select * from bus where id =? ";
		PreparedStatement pstmt = con.prepareStatement(sql);
		pstmt.setString(1, busId);

		ResultSet rs = pstmt.executeQuery();
		if (rs.next()) {
	%>
	<div class="content">
		<div class="row">
		<label>预订车票</label>
		<div class="form">
			<form class="form-horizontal w550" role="form"
				action="<%=basePath%>front/ticket/ticketAdd_handle.jsp" method="post">
				<div class="form-group">
					<label for="inputEmail3" class="col-sm-2 control-label">汽车车次</label>
					<div class="col-sm-10">
						<input type="hidden" name="id" value="<%=rs.getString(1)%>" />
						<%=rs.getString(2)%> 
					</div>
				</div>
				<div class="form-group">
					<label for="inputName3" class="col-sm-2 control-label">出发站</label>
					<div class="col-sm-10">
						<%=rs.getString(3)%> 
					</div>
				</div>
				<div class="form-group">
					<label for="inputName3" class="col-sm-2 control-label">终点站</label>
					<div class="col-sm-10">
						<%=rs.getString(4)%> 
					</div>
				</div>
				<div class="form-group">
					<label for="inputPassword3" class="col-sm-2 control-label">出发时间</label>
					<div class="col-sm-10">
						<%=rs.getString(6)%> 
					</div>
				</div>
				<div class="form-group">
					<label for="inputPassword3" class="col-sm-2 control-label">价格</label>
					<div class="col-sm-10">
						<%=rs.getString(5)%> 
					</div>
				</div>
				<div class="form-group">
					<label for="inputPassword3" class="col-sm-2 control-label">数量</label>
					<div class="col-sm-10">
						<input type="text" name="counts"  class="form-control" />
					</div>
				</div>
				<div class="form-group">
					<div class="col-sm-offset-2 col-sm-10">
						<button type="submit" class="btn btn-default">提 交</button>
					</div>
				</div>
			</form>
	</div>
		</div>
	</div>
	<%
		} else {
			session.setAttribute("errorinfo", Constant.ERRORINFO_NETERROR);
	%>
	<jsp:forward page="/front/result.jsp" />
	<%
		}
	%>
	<jsp:include page="/front/common/footer.jsp"></jsp:include>
</body>
</html>